﻿#region Using directives

using System;
using System.Data;
using System.Data.Common;
using System.Collections;
using System.Collections.Generic;

using PAT.Entities;
using PAT.Data;

#endregion

namespace PAT.Data.Bases
{	
	///<summary>
	/// This class is the base class for any <see cref="PatCatalogoVehiculoProviderBase"/> implementation.
	/// It exposes CRUD methods as well as selecting on index, foreign keys and custom stored procedures.
	///</summary>
	public abstract partial class PatCatalogoVehiculoProviderBaseCore : EntityProviderBase<PAT.Entities.PatCatalogoVehiculo, PAT.Entities.PatCatalogoVehiculoKey>
	{		
		#region Get from Many To Many Relationship Functions
		#region GetByIdItemInventarioFromPatItemCatalogo
		
		/// <summary>
		///		Gets PAT_CATALOGO_VEHICULO objects from the datasource by ID_ITEM_INVENTARIO in the
		///		PAT_ITEM_CATALOGO table. Table PAT_CATALOGO_VEHICULO is related to table PAT_ITEM_INVENTARIO
		///		through the (M:N) relationship defined in the PAT_ITEM_CATALOGO table.
		/// </summary>
		/// <param name="_idItemInventario"></param>
		/// <returns>Returns a typed collection of PatCatalogoVehiculo objects.</returns>
		public TList<PatCatalogoVehiculo> GetByIdItemInventarioFromPatItemCatalogo(System.Int32 _idItemInventario)
		{
			int count = -1;
			return GetByIdItemInventarioFromPatItemCatalogo(null,_idItemInventario, 0, int.MaxValue, out count);
			
		}
		
		/// <summary>
		///		Gets PAT.Entities.PatCatalogoVehiculo objects from the datasource by ID_ITEM_INVENTARIO in the
		///		PAT_ITEM_CATALOGO table. Table PAT_CATALOGO_VEHICULO is related to table PAT_ITEM_INVENTARIO
		///		through the (M:N) relationship defined in the PAT_ITEM_CATALOGO table.
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="_idItemInventario"></param>
		/// <remarks></remarks>
		/// <returns>Returns a TList of PatCatalogoVehiculo objects.</returns>
		public TList<PatCatalogoVehiculo> GetByIdItemInventarioFromPatItemCatalogo(System.Int32 _idItemInventario, int start, int pageLength)
		{
			int count = -1;
			return GetByIdItemInventarioFromPatItemCatalogo(null, _idItemInventario, start, pageLength, out count);
		}
		
		/// <summary>
		///		Gets PatCatalogoVehiculo objects from the datasource by ID_ITEM_INVENTARIO in the
		///		PAT_ITEM_CATALOGO table. Table PAT_CATALOGO_VEHICULO is related to table PAT_ITEM_INVENTARIO
		///		through the (M:N) relationship defined in the PAT_ITEM_CATALOGO table.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_idItemInventario"></param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of PAT_CATALOGO_VEHICULO objects.</returns>
		public TList<PatCatalogoVehiculo> GetByIdItemInventarioFromPatItemCatalogo(TransactionManager transactionManager, System.Int32 _idItemInventario)
		{
			int count = -1;
			return GetByIdItemInventarioFromPatItemCatalogo(transactionManager, _idItemInventario, 0, int.MaxValue, out count);
		}
		
		
		/// <summary>
		///		Gets PatCatalogoVehiculo objects from the datasource by ID_ITEM_INVENTARIO in the
		///		PAT_ITEM_CATALOGO table. Table PAT_CATALOGO_VEHICULO is related to table PAT_ITEM_INVENTARIO
		///		through the (M:N) relationship defined in the PAT_ITEM_CATALOGO table.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_idItemInventario"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		///  <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of PAT_CATALOGO_VEHICULO objects.</returns>
		public TList<PatCatalogoVehiculo> GetByIdItemInventarioFromPatItemCatalogo(TransactionManager transactionManager, System.Int32 _idItemInventario,int start, int pageLength)
		{
			int count = -1;
			return GetByIdItemInventarioFromPatItemCatalogo(transactionManager, _idItemInventario, start, pageLength, out count);
		}
		
		/// <summary>
		///		Gets PatCatalogoVehiculo objects from the datasource by ID_ITEM_INVENTARIO in the
		///		PAT_ITEM_CATALOGO table. Table PAT_CATALOGO_VEHICULO is related to table PAT_ITEM_INVENTARIO
		///		through the (M:N) relationship defined in the PAT_ITEM_CATALOGO table.
		/// </summary>
		/// <param name="_idItemInventario"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		///  <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of PAT_CATALOGO_VEHICULO objects.</returns>
		public TList<PatCatalogoVehiculo> GetByIdItemInventarioFromPatItemCatalogo(System.Int32 _idItemInventario,int start, int pageLength, out int count)
		{
			
			return GetByIdItemInventarioFromPatItemCatalogo(null, _idItemInventario, start, pageLength, out count);
		}


		/// <summary>
		///		Gets PAT_CATALOGO_VEHICULO objects from the datasource by ID_ITEM_INVENTARIO in the
		///		PAT_ITEM_CATALOGO table. Table PAT_CATALOGO_VEHICULO is related to table PAT_ITEM_INVENTARIO
		///		through the (M:N) relationship defined in the PAT_ITEM_CATALOGO table.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <param name="_idItemInventario"></param>
		/// <remarks></remarks>
		/// <returns>Returns a TList of PatCatalogoVehiculo objects.</returns>
		public abstract TList<PatCatalogoVehiculo> GetByIdItemInventarioFromPatItemCatalogo(TransactionManager transactionManager,System.Int32 _idItemInventario, int start, int pageLength, out int count);
		
		#endregion GetByIdItemInventarioFromPatItemCatalogo
		
		#endregion	
		
		#region Delete Methods

		/// <summary>
		/// 	Deletes a row from the DataSource.
		/// </summary>
		/// <param name="transactionManager">A <see cref="TransactionManager"/> object.</param>
		/// <param name="key">The unique identifier of the row to delete.</param>
		/// <returns>Returns true if operation suceeded.</returns>
		public override bool Delete(TransactionManager transactionManager, PAT.Entities.PatCatalogoVehiculoKey key)
		{
			return Delete(transactionManager, key.IdCatalogo);
		}
		
		/// <summary>
		/// 	Deletes a row from the DataSource.
		/// </summary>
		/// <param name="_idCatalogo">. Primary Key.</param>
		/// <remarks>Deletes based on primary key(s).</remarks>
		/// <returns>Returns true if operation suceeded.</returns>
		public bool Delete(System.Int32 _idCatalogo)
		{
			return Delete(null, _idCatalogo);
		}
		
		/// <summary>
		/// 	Deletes a row from the DataSource.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_idCatalogo">. Primary Key.</param>
		/// <remarks>Deletes based on primary key(s).</remarks>
		/// <returns>Returns true if operation suceeded.</returns>
		public abstract bool Delete(TransactionManager transactionManager, System.Int32 _idCatalogo);		
		
		#endregion Delete Methods
		
		#region Get By Foreign Key Functions
	
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PAT_CATALOGO_VEHICULO_PAT_CLASE_VEHICULO key.
		///		FK_PAT_CATALOGO_VEHICULO_PAT_CLASE_VEHICULO Description: 
		/// </summary>
		/// <param name="_idClaseVehiculo"></param>
		/// <returns>Returns a typed collection of PAT.Entities.PatCatalogoVehiculo objects.</returns>
		public TList<PatCatalogoVehiculo> GetByIdClaseVehiculo(System.Byte _idClaseVehiculo)
		{
			int count = -1;
			return GetByIdClaseVehiculo(_idClaseVehiculo, 0,int.MaxValue, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PAT_CATALOGO_VEHICULO_PAT_CLASE_VEHICULO key.
		///		FK_PAT_CATALOGO_VEHICULO_PAT_CLASE_VEHICULO Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_idClaseVehiculo"></param>
		/// <returns>Returns a typed collection of PAT.Entities.PatCatalogoVehiculo objects.</returns>
		/// <remarks></remarks>
		public TList<PatCatalogoVehiculo> GetByIdClaseVehiculo(TransactionManager transactionManager, System.Byte _idClaseVehiculo)
		{
			int count = -1;
			return GetByIdClaseVehiculo(transactionManager, _idClaseVehiculo, 0, int.MaxValue, out count);
		}
		
			/// <summary>
		/// 	Gets rows from the datasource based on the FK_PAT_CATALOGO_VEHICULO_PAT_CLASE_VEHICULO key.
		///		FK_PAT_CATALOGO_VEHICULO_PAT_CLASE_VEHICULO Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_idClaseVehiculo"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		///  <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of PAT.Entities.PatCatalogoVehiculo objects.</returns>
		public TList<PatCatalogoVehiculo> GetByIdClaseVehiculo(TransactionManager transactionManager, System.Byte _idClaseVehiculo, int start, int pageLength)
		{
			int count = -1;
			return GetByIdClaseVehiculo(transactionManager, _idClaseVehiculo, start, pageLength, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PAT_CATALOGO_VEHICULO_PAT_CLASE_VEHICULO key.
		///		fkPatCatalogoVehiculoPatClaseVehiculo Description: 
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="_idClaseVehiculo"></param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of PAT.Entities.PatCatalogoVehiculo objects.</returns>
		public TList<PatCatalogoVehiculo> GetByIdClaseVehiculo(System.Byte _idClaseVehiculo, int start, int pageLength)
		{
			int count =  -1;
			return GetByIdClaseVehiculo(null, _idClaseVehiculo, start, pageLength,out count);	
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PAT_CATALOGO_VEHICULO_PAT_CLASE_VEHICULO key.
		///		fkPatCatalogoVehiculoPatClaseVehiculo Description: 
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="_idClaseVehiculo"></param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of PAT.Entities.PatCatalogoVehiculo objects.</returns>
		public TList<PatCatalogoVehiculo> GetByIdClaseVehiculo(System.Byte _idClaseVehiculo, int start, int pageLength,out int count)
		{
			return GetByIdClaseVehiculo(null, _idClaseVehiculo, start, pageLength, out count);	
		}
						
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PAT_CATALOGO_VEHICULO_PAT_CLASE_VEHICULO key.
		///		FK_PAT_CATALOGO_VEHICULO_PAT_CLASE_VEHICULO Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_idClaseVehiculo"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">The total number of records.</param>
		/// <returns>Returns a typed collection of PAT.Entities.PatCatalogoVehiculo objects.</returns>
		public abstract TList<PatCatalogoVehiculo> GetByIdClaseVehiculo(TransactionManager transactionManager, System.Byte _idClaseVehiculo, int start, int pageLength, out int count);
		
	
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PAT_CATALOGO_VEHICULO_PAT_GAMA_VEHICULO key.
		///		FK_PAT_CATALOGO_VEHICULO_PAT_GAMA_VEHICULO Description: 
		/// </summary>
		/// <param name="_idGamaVehiculo"></param>
		/// <returns>Returns a typed collection of PAT.Entities.PatCatalogoVehiculo objects.</returns>
		public TList<PatCatalogoVehiculo> GetByIdGamaVehiculo(System.Byte _idGamaVehiculo)
		{
			int count = -1;
			return GetByIdGamaVehiculo(_idGamaVehiculo, 0,int.MaxValue, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PAT_CATALOGO_VEHICULO_PAT_GAMA_VEHICULO key.
		///		FK_PAT_CATALOGO_VEHICULO_PAT_GAMA_VEHICULO Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_idGamaVehiculo"></param>
		/// <returns>Returns a typed collection of PAT.Entities.PatCatalogoVehiculo objects.</returns>
		/// <remarks></remarks>
		public TList<PatCatalogoVehiculo> GetByIdGamaVehiculo(TransactionManager transactionManager, System.Byte _idGamaVehiculo)
		{
			int count = -1;
			return GetByIdGamaVehiculo(transactionManager, _idGamaVehiculo, 0, int.MaxValue, out count);
		}
		
			/// <summary>
		/// 	Gets rows from the datasource based on the FK_PAT_CATALOGO_VEHICULO_PAT_GAMA_VEHICULO key.
		///		FK_PAT_CATALOGO_VEHICULO_PAT_GAMA_VEHICULO Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_idGamaVehiculo"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		///  <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of PAT.Entities.PatCatalogoVehiculo objects.</returns>
		public TList<PatCatalogoVehiculo> GetByIdGamaVehiculo(TransactionManager transactionManager, System.Byte _idGamaVehiculo, int start, int pageLength)
		{
			int count = -1;
			return GetByIdGamaVehiculo(transactionManager, _idGamaVehiculo, start, pageLength, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PAT_CATALOGO_VEHICULO_PAT_GAMA_VEHICULO key.
		///		fkPatCatalogoVehiculoPatGamaVehiculo Description: 
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="_idGamaVehiculo"></param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of PAT.Entities.PatCatalogoVehiculo objects.</returns>
		public TList<PatCatalogoVehiculo> GetByIdGamaVehiculo(System.Byte _idGamaVehiculo, int start, int pageLength)
		{
			int count =  -1;
			return GetByIdGamaVehiculo(null, _idGamaVehiculo, start, pageLength,out count);	
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PAT_CATALOGO_VEHICULO_PAT_GAMA_VEHICULO key.
		///		fkPatCatalogoVehiculoPatGamaVehiculo Description: 
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="_idGamaVehiculo"></param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of PAT.Entities.PatCatalogoVehiculo objects.</returns>
		public TList<PatCatalogoVehiculo> GetByIdGamaVehiculo(System.Byte _idGamaVehiculo, int start, int pageLength,out int count)
		{
			return GetByIdGamaVehiculo(null, _idGamaVehiculo, start, pageLength, out count);	
		}
						
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PAT_CATALOGO_VEHICULO_PAT_GAMA_VEHICULO key.
		///		FK_PAT_CATALOGO_VEHICULO_PAT_GAMA_VEHICULO Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_idGamaVehiculo"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">The total number of records.</param>
		/// <returns>Returns a typed collection of PAT.Entities.PatCatalogoVehiculo objects.</returns>
		public abstract TList<PatCatalogoVehiculo> GetByIdGamaVehiculo(TransactionManager transactionManager, System.Byte _idGamaVehiculo, int start, int pageLength, out int count);
		
	
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PAT_CATALOGO_VEHICULO_PAT_GRUPO_CATALOGO key.
		///		FK_PAT_CATALOGO_VEHICULO_PAT_GRUPO_CATALOGO Description: 
		/// </summary>
		/// <param name="_idGrupoCatalogo"></param>
		/// <returns>Returns a typed collection of PAT.Entities.PatCatalogoVehiculo objects.</returns>
		public TList<PatCatalogoVehiculo> GetByIdGrupoCatalogo(System.Int16 _idGrupoCatalogo)
		{
			int count = -1;
			return GetByIdGrupoCatalogo(_idGrupoCatalogo, 0,int.MaxValue, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PAT_CATALOGO_VEHICULO_PAT_GRUPO_CATALOGO key.
		///		FK_PAT_CATALOGO_VEHICULO_PAT_GRUPO_CATALOGO Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_idGrupoCatalogo"></param>
		/// <returns>Returns a typed collection of PAT.Entities.PatCatalogoVehiculo objects.</returns>
		/// <remarks></remarks>
		public TList<PatCatalogoVehiculo> GetByIdGrupoCatalogo(TransactionManager transactionManager, System.Int16 _idGrupoCatalogo)
		{
			int count = -1;
			return GetByIdGrupoCatalogo(transactionManager, _idGrupoCatalogo, 0, int.MaxValue, out count);
		}
		
			/// <summary>
		/// 	Gets rows from the datasource based on the FK_PAT_CATALOGO_VEHICULO_PAT_GRUPO_CATALOGO key.
		///		FK_PAT_CATALOGO_VEHICULO_PAT_GRUPO_CATALOGO Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_idGrupoCatalogo"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		///  <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of PAT.Entities.PatCatalogoVehiculo objects.</returns>
		public TList<PatCatalogoVehiculo> GetByIdGrupoCatalogo(TransactionManager transactionManager, System.Int16 _idGrupoCatalogo, int start, int pageLength)
		{
			int count = -1;
			return GetByIdGrupoCatalogo(transactionManager, _idGrupoCatalogo, start, pageLength, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PAT_CATALOGO_VEHICULO_PAT_GRUPO_CATALOGO key.
		///		fkPatCatalogoVehiculoPatGrupoCatalogo Description: 
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="_idGrupoCatalogo"></param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of PAT.Entities.PatCatalogoVehiculo objects.</returns>
		public TList<PatCatalogoVehiculo> GetByIdGrupoCatalogo(System.Int16 _idGrupoCatalogo, int start, int pageLength)
		{
			int count =  -1;
			return GetByIdGrupoCatalogo(null, _idGrupoCatalogo, start, pageLength,out count);	
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PAT_CATALOGO_VEHICULO_PAT_GRUPO_CATALOGO key.
		///		fkPatCatalogoVehiculoPatGrupoCatalogo Description: 
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="_idGrupoCatalogo"></param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of PAT.Entities.PatCatalogoVehiculo objects.</returns>
		public TList<PatCatalogoVehiculo> GetByIdGrupoCatalogo(System.Int16 _idGrupoCatalogo, int start, int pageLength,out int count)
		{
			return GetByIdGrupoCatalogo(null, _idGrupoCatalogo, start, pageLength, out count);	
		}
						
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PAT_CATALOGO_VEHICULO_PAT_GRUPO_CATALOGO key.
		///		FK_PAT_CATALOGO_VEHICULO_PAT_GRUPO_CATALOGO Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_idGrupoCatalogo"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">The total number of records.</param>
		/// <returns>Returns a typed collection of PAT.Entities.PatCatalogoVehiculo objects.</returns>
		public abstract TList<PatCatalogoVehiculo> GetByIdGrupoCatalogo(TransactionManager transactionManager, System.Int16 _idGrupoCatalogo, int start, int pageLength, out int count);
		
	
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PAT_CATALOGO_VEHICULO_PAT_MARCA_VEHICULO key.
		///		FK_PAT_CATALOGO_VEHICULO_PAT_MARCA_VEHICULO Description: 
		/// </summary>
		/// <param name="_idMarcaVehiculo"></param>
		/// <returns>Returns a typed collection of PAT.Entities.PatCatalogoVehiculo objects.</returns>
		public TList<PatCatalogoVehiculo> GetByIdMarcaVehiculo(System.Int16 _idMarcaVehiculo)
		{
			int count = -1;
			return GetByIdMarcaVehiculo(_idMarcaVehiculo, 0,int.MaxValue, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PAT_CATALOGO_VEHICULO_PAT_MARCA_VEHICULO key.
		///		FK_PAT_CATALOGO_VEHICULO_PAT_MARCA_VEHICULO Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_idMarcaVehiculo"></param>
		/// <returns>Returns a typed collection of PAT.Entities.PatCatalogoVehiculo objects.</returns>
		/// <remarks></remarks>
		public TList<PatCatalogoVehiculo> GetByIdMarcaVehiculo(TransactionManager transactionManager, System.Int16 _idMarcaVehiculo)
		{
			int count = -1;
			return GetByIdMarcaVehiculo(transactionManager, _idMarcaVehiculo, 0, int.MaxValue, out count);
		}
		
			/// <summary>
		/// 	Gets rows from the datasource based on the FK_PAT_CATALOGO_VEHICULO_PAT_MARCA_VEHICULO key.
		///		FK_PAT_CATALOGO_VEHICULO_PAT_MARCA_VEHICULO Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_idMarcaVehiculo"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		///  <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of PAT.Entities.PatCatalogoVehiculo objects.</returns>
		public TList<PatCatalogoVehiculo> GetByIdMarcaVehiculo(TransactionManager transactionManager, System.Int16 _idMarcaVehiculo, int start, int pageLength)
		{
			int count = -1;
			return GetByIdMarcaVehiculo(transactionManager, _idMarcaVehiculo, start, pageLength, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PAT_CATALOGO_VEHICULO_PAT_MARCA_VEHICULO key.
		///		fkPatCatalogoVehiculoPatMarcaVehiculo Description: 
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="_idMarcaVehiculo"></param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of PAT.Entities.PatCatalogoVehiculo objects.</returns>
		public TList<PatCatalogoVehiculo> GetByIdMarcaVehiculo(System.Int16 _idMarcaVehiculo, int start, int pageLength)
		{
			int count =  -1;
			return GetByIdMarcaVehiculo(null, _idMarcaVehiculo, start, pageLength,out count);	
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PAT_CATALOGO_VEHICULO_PAT_MARCA_VEHICULO key.
		///		fkPatCatalogoVehiculoPatMarcaVehiculo Description: 
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="_idMarcaVehiculo"></param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of PAT.Entities.PatCatalogoVehiculo objects.</returns>
		public TList<PatCatalogoVehiculo> GetByIdMarcaVehiculo(System.Int16 _idMarcaVehiculo, int start, int pageLength,out int count)
		{
			return GetByIdMarcaVehiculo(null, _idMarcaVehiculo, start, pageLength, out count);	
		}
						
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PAT_CATALOGO_VEHICULO_PAT_MARCA_VEHICULO key.
		///		FK_PAT_CATALOGO_VEHICULO_PAT_MARCA_VEHICULO Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_idMarcaVehiculo"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">The total number of records.</param>
		/// <returns>Returns a typed collection of PAT.Entities.PatCatalogoVehiculo objects.</returns>
		public abstract TList<PatCatalogoVehiculo> GetByIdMarcaVehiculo(TransactionManager transactionManager, System.Int16 _idMarcaVehiculo, int start, int pageLength, out int count);
		
	
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PAT_CATALOGO_VEHICULO_PAT_TIPO_COMBUSTIBLE key.
		///		FK_PAT_CATALOGO_VEHICULO_PAT_TIPO_COMBUSTIBLE Description: 
		/// </summary>
		/// <param name="_idTipoCombustible"></param>
		/// <returns>Returns a typed collection of PAT.Entities.PatCatalogoVehiculo objects.</returns>
		public TList<PatCatalogoVehiculo> GetByIdTipoCombustible(System.Byte _idTipoCombustible)
		{
			int count = -1;
			return GetByIdTipoCombustible(_idTipoCombustible, 0,int.MaxValue, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PAT_CATALOGO_VEHICULO_PAT_TIPO_COMBUSTIBLE key.
		///		FK_PAT_CATALOGO_VEHICULO_PAT_TIPO_COMBUSTIBLE Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_idTipoCombustible"></param>
		/// <returns>Returns a typed collection of PAT.Entities.PatCatalogoVehiculo objects.</returns>
		/// <remarks></remarks>
		public TList<PatCatalogoVehiculo> GetByIdTipoCombustible(TransactionManager transactionManager, System.Byte _idTipoCombustible)
		{
			int count = -1;
			return GetByIdTipoCombustible(transactionManager, _idTipoCombustible, 0, int.MaxValue, out count);
		}
		
			/// <summary>
		/// 	Gets rows from the datasource based on the FK_PAT_CATALOGO_VEHICULO_PAT_TIPO_COMBUSTIBLE key.
		///		FK_PAT_CATALOGO_VEHICULO_PAT_TIPO_COMBUSTIBLE Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_idTipoCombustible"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		///  <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of PAT.Entities.PatCatalogoVehiculo objects.</returns>
		public TList<PatCatalogoVehiculo> GetByIdTipoCombustible(TransactionManager transactionManager, System.Byte _idTipoCombustible, int start, int pageLength)
		{
			int count = -1;
			return GetByIdTipoCombustible(transactionManager, _idTipoCombustible, start, pageLength, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PAT_CATALOGO_VEHICULO_PAT_TIPO_COMBUSTIBLE key.
		///		fkPatCatalogoVehiculoPatTipoCombustible Description: 
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="_idTipoCombustible"></param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of PAT.Entities.PatCatalogoVehiculo objects.</returns>
		public TList<PatCatalogoVehiculo> GetByIdTipoCombustible(System.Byte _idTipoCombustible, int start, int pageLength)
		{
			int count =  -1;
			return GetByIdTipoCombustible(null, _idTipoCombustible, start, pageLength,out count);	
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PAT_CATALOGO_VEHICULO_PAT_TIPO_COMBUSTIBLE key.
		///		fkPatCatalogoVehiculoPatTipoCombustible Description: 
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="_idTipoCombustible"></param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of PAT.Entities.PatCatalogoVehiculo objects.</returns>
		public TList<PatCatalogoVehiculo> GetByIdTipoCombustible(System.Byte _idTipoCombustible, int start, int pageLength,out int count)
		{
			return GetByIdTipoCombustible(null, _idTipoCombustible, start, pageLength, out count);	
		}
						
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PAT_CATALOGO_VEHICULO_PAT_TIPO_COMBUSTIBLE key.
		///		FK_PAT_CATALOGO_VEHICULO_PAT_TIPO_COMBUSTIBLE Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_idTipoCombustible"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">The total number of records.</param>
		/// <returns>Returns a typed collection of PAT.Entities.PatCatalogoVehiculo objects.</returns>
		public abstract TList<PatCatalogoVehiculo> GetByIdTipoCombustible(TransactionManager transactionManager, System.Byte _idTipoCombustible, int start, int pageLength, out int count);
		
	
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PAT_CATALOGO_VEHICULO_PAT_TIPO_SERVICIO key.
		///		FK_PAT_CATALOGO_VEHICULO_PAT_TIPO_SERVICIO Description: 
		/// </summary>
		/// <param name="_idTipoServicio"></param>
		/// <returns>Returns a typed collection of PAT.Entities.PatCatalogoVehiculo objects.</returns>
		public TList<PatCatalogoVehiculo> GetByIdTipoServicio(System.Byte _idTipoServicio)
		{
			int count = -1;
			return GetByIdTipoServicio(_idTipoServicio, 0,int.MaxValue, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PAT_CATALOGO_VEHICULO_PAT_TIPO_SERVICIO key.
		///		FK_PAT_CATALOGO_VEHICULO_PAT_TIPO_SERVICIO Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_idTipoServicio"></param>
		/// <returns>Returns a typed collection of PAT.Entities.PatCatalogoVehiculo objects.</returns>
		/// <remarks></remarks>
		public TList<PatCatalogoVehiculo> GetByIdTipoServicio(TransactionManager transactionManager, System.Byte _idTipoServicio)
		{
			int count = -1;
			return GetByIdTipoServicio(transactionManager, _idTipoServicio, 0, int.MaxValue, out count);
		}
		
			/// <summary>
		/// 	Gets rows from the datasource based on the FK_PAT_CATALOGO_VEHICULO_PAT_TIPO_SERVICIO key.
		///		FK_PAT_CATALOGO_VEHICULO_PAT_TIPO_SERVICIO Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_idTipoServicio"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		///  <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of PAT.Entities.PatCatalogoVehiculo objects.</returns>
		public TList<PatCatalogoVehiculo> GetByIdTipoServicio(TransactionManager transactionManager, System.Byte _idTipoServicio, int start, int pageLength)
		{
			int count = -1;
			return GetByIdTipoServicio(transactionManager, _idTipoServicio, start, pageLength, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PAT_CATALOGO_VEHICULO_PAT_TIPO_SERVICIO key.
		///		fkPatCatalogoVehiculoPatTipoServicio Description: 
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="_idTipoServicio"></param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of PAT.Entities.PatCatalogoVehiculo objects.</returns>
		public TList<PatCatalogoVehiculo> GetByIdTipoServicio(System.Byte _idTipoServicio, int start, int pageLength)
		{
			int count =  -1;
			return GetByIdTipoServicio(null, _idTipoServicio, start, pageLength,out count);	
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PAT_CATALOGO_VEHICULO_PAT_TIPO_SERVICIO key.
		///		fkPatCatalogoVehiculoPatTipoServicio Description: 
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="_idTipoServicio"></param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of PAT.Entities.PatCatalogoVehiculo objects.</returns>
		public TList<PatCatalogoVehiculo> GetByIdTipoServicio(System.Byte _idTipoServicio, int start, int pageLength,out int count)
		{
			return GetByIdTipoServicio(null, _idTipoServicio, start, pageLength, out count);	
		}
						
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PAT_CATALOGO_VEHICULO_PAT_TIPO_SERVICIO key.
		///		FK_PAT_CATALOGO_VEHICULO_PAT_TIPO_SERVICIO Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_idTipoServicio"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">The total number of records.</param>
		/// <returns>Returns a typed collection of PAT.Entities.PatCatalogoVehiculo objects.</returns>
		public abstract TList<PatCatalogoVehiculo> GetByIdTipoServicio(TransactionManager transactionManager, System.Byte _idTipoServicio, int start, int pageLength, out int count);
		
		#endregion

		#region Get By Index Functions
		
		/// <summary>
		/// 	Gets a row from the DataSource based on its primary key.
		/// </summary>
		/// <param name="transactionManager">A <see cref="TransactionManager"/> object.</param>
		/// <param name="key">The unique identifier of the row to retrieve.</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <returns>Returns an instance of the Entity class.</returns>
		public override PAT.Entities.PatCatalogoVehiculo Get(TransactionManager transactionManager, PAT.Entities.PatCatalogoVehiculoKey key, int start, int pageLength)
		{
			return GetByIdCatalogo(transactionManager, key.IdCatalogo, start, pageLength);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the primary key PK_PAT_CATALOGO_VEHICULO index.
		/// </summary>
		/// <param name="_idCatalogo"></param>
		/// <returns>Returns an instance of the <see cref="PAT.Entities.PatCatalogoVehiculo"/> class.</returns>
		public PAT.Entities.PatCatalogoVehiculo GetByIdCatalogo(System.Int32 _idCatalogo)
		{
			int count = -1;
			return GetByIdCatalogo(null,_idCatalogo, 0, int.MaxValue, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the PK_PAT_CATALOGO_VEHICULO index.
		/// </summary>
		/// <param name="_idCatalogo"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="PAT.Entities.PatCatalogoVehiculo"/> class.</returns>
		public PAT.Entities.PatCatalogoVehiculo GetByIdCatalogo(System.Int32 _idCatalogo, int start, int pageLength)
		{
			int count = -1;
			return GetByIdCatalogo(null, _idCatalogo, start, pageLength, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the PK_PAT_CATALOGO_VEHICULO index.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_idCatalogo"></param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="PAT.Entities.PatCatalogoVehiculo"/> class.</returns>
		public PAT.Entities.PatCatalogoVehiculo GetByIdCatalogo(TransactionManager transactionManager, System.Int32 _idCatalogo)
		{
			int count = -1;
			return GetByIdCatalogo(transactionManager, _idCatalogo, 0, int.MaxValue, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the PK_PAT_CATALOGO_VEHICULO index.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_idCatalogo"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="PAT.Entities.PatCatalogoVehiculo"/> class.</returns>
		public PAT.Entities.PatCatalogoVehiculo GetByIdCatalogo(TransactionManager transactionManager, System.Int32 _idCatalogo, int start, int pageLength)
		{
			int count = -1;
			return GetByIdCatalogo(transactionManager, _idCatalogo, start, pageLength, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the PK_PAT_CATALOGO_VEHICULO index.
		/// </summary>
		/// <param name="_idCatalogo"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="PAT.Entities.PatCatalogoVehiculo"/> class.</returns>
		public PAT.Entities.PatCatalogoVehiculo GetByIdCatalogo(System.Int32 _idCatalogo, int start, int pageLength, out int count)
		{
			return GetByIdCatalogo(null, _idCatalogo, start, pageLength, out count);
		}
		
				
		/// <summary>
		/// 	Gets rows from the datasource based on the PK_PAT_CATALOGO_VEHICULO index.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_idCatalogo"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">The total number of records.</param>
		/// <returns>Returns an instance of the <see cref="PAT.Entities.PatCatalogoVehiculo"/> class.</returns>
		public abstract PAT.Entities.PatCatalogoVehiculo GetByIdCatalogo(TransactionManager transactionManager, System.Int32 _idCatalogo, int start, int pageLength, out int count);
						
		#endregion "Get By Index Functions"
	
		#region Custom Methods
		
		
		#endregion

		#region Helper Functions	
		
		/// <summary>
		/// Fill a TList&lt;PatCatalogoVehiculo&gt; From a DataReader.
		/// </summary>
		/// <param name="reader">Datareader</param>
		/// <param name="rows">The collection to fill</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">number of rows.</param>
		/// <returns>a <see cref="TList&lt;PatCatalogoVehiculo&gt;"/></returns>
		public static TList<PatCatalogoVehiculo> Fill(IDataReader reader, TList<PatCatalogoVehiculo> rows, int start, int pageLength)
		{
			NetTiersProvider currentProvider = DataRepository.Provider;
            bool useEntityFactory = currentProvider.UseEntityFactory;
            bool enableEntityTracking = currentProvider.EnableEntityTracking;
            LoadPolicy currentLoadPolicy = currentProvider.CurrentLoadPolicy;
			Type entityCreationFactoryType = currentProvider.EntityCreationalFactoryType;
			
			// advance to the starting row
			for (int i = 0; i < start; i++)
			{
				if (!reader.Read())
				return rows; // not enough rows, just return
			}
			for (int i = 0; i < pageLength; i++)
			{
				if (!reader.Read())
					break; // we are done
					
				string key = null;
				
				PAT.Entities.PatCatalogoVehiculo c = null;
				if (useEntityFactory)
				{
					key = new System.Text.StringBuilder("PatCatalogoVehiculo")
					.Append("|").Append((System.Int32)reader[((int)PatCatalogoVehiculoColumn.IdCatalogo - 1)]).ToString();
					c = EntityManager.LocateOrCreate<PatCatalogoVehiculo>(
					key.ToString(), // EntityTrackingKey
					"PatCatalogoVehiculo",  //Creational Type
					entityCreationFactoryType,  //Factory used to create entity
					enableEntityTracking); // Track this entity?
				}
				else
				{
					c = new PAT.Entities.PatCatalogoVehiculo();
				}
				
				if (!enableEntityTracking ||
					c.EntityState == EntityState.Added ||
					(enableEntityTracking &&
					
						(
							(currentLoadPolicy == LoadPolicy.PreserveChanges && c.EntityState == EntityState.Unchanged) ||
							(currentLoadPolicy == LoadPolicy.DiscardChanges && c.EntityState != EntityState.Unchanged)
						)
					))
				{
					c.SuppressEntityEvents = true;
					c.IdCatalogo = (System.Int32)reader[((int)PatCatalogoVehiculoColumn.IdCatalogo - 1)];
					c.CodigoInternoCatalogo = (System.String)reader[((int)PatCatalogoVehiculoColumn.CodigoInternoCatalogo - 1)];
					c.DescripcionCatalogo = (System.String)reader[((int)PatCatalogoVehiculoColumn.DescripcionCatalogo - 1)];
					c.Cilindraje = (System.String)reader[((int)PatCatalogoVehiculoColumn.Cilindraje - 1)];
					c.IdMarcaVehiculo = (System.Int16)reader[((int)PatCatalogoVehiculoColumn.IdMarcaVehiculo - 1)];
					c.IdTipoServicio = (System.Byte)reader[((int)PatCatalogoVehiculoColumn.IdTipoServicio - 1)];
					c.IdClaseVehiculo = (System.Byte)reader[((int)PatCatalogoVehiculoColumn.IdClaseVehiculo - 1)];
					c.CapacidadPasajeros = (System.Byte)reader[((int)PatCatalogoVehiculoColumn.CapacidadPasajeros - 1)];
					c.CapacidadCarga = (System.Int16)reader[((int)PatCatalogoVehiculoColumn.CapacidadCarga - 1)];
					c.NumeroPuertas = (System.Byte)reader[((int)PatCatalogoVehiculoColumn.NumeroPuertas - 1)];
					c.CodigoTransito = (System.String)reader[((int)PatCatalogoVehiculoColumn.CodigoTransito - 1)];
					c.PorcentajeIva = (System.Decimal)reader[((int)PatCatalogoVehiculoColumn.PorcentajeIva - 1)];
					c.IdGamaVehiculo = (System.Byte)reader[((int)PatCatalogoVehiculoColumn.IdGamaVehiculo - 1)];
					c.IdGrupoCatalogo = (System.Int16)reader[((int)PatCatalogoVehiculoColumn.IdGrupoCatalogo - 1)];
					c.VinBasico = (System.String)reader[((int)PatCatalogoVehiculoColumn.VinBasico - 1)];
					c.Activo = (System.Boolean)reader[((int)PatCatalogoVehiculoColumn.Activo - 1)];
					c.IdTipoCombustible = (System.Byte)reader[((int)PatCatalogoVehiculoColumn.IdTipoCombustible - 1)];
					c.EntityTrackingKey = key;
					c.AcceptChanges();
					c.SuppressEntityEvents = false;
				}
				rows.Add(c);
			}
		return rows;
		}		
		/// <summary>
		/// Refreshes the <see cref="PAT.Entities.PatCatalogoVehiculo"/> object from the <see cref="IDataReader"/>.
		/// </summary>
		/// <param name="reader">The <see cref="IDataReader"/> to read from.</param>
		/// <param name="entity">The <see cref="PAT.Entities.PatCatalogoVehiculo"/> object to refresh.</param>
		public static void RefreshEntity(IDataReader reader, PAT.Entities.PatCatalogoVehiculo entity)
		{
			if (!reader.Read()) return;
			
			entity.IdCatalogo = (System.Int32)reader[((int)PatCatalogoVehiculoColumn.IdCatalogo - 1)];
			entity.CodigoInternoCatalogo = (System.String)reader[((int)PatCatalogoVehiculoColumn.CodigoInternoCatalogo - 1)];
			entity.DescripcionCatalogo = (System.String)reader[((int)PatCatalogoVehiculoColumn.DescripcionCatalogo - 1)];
			entity.Cilindraje = (System.String)reader[((int)PatCatalogoVehiculoColumn.Cilindraje - 1)];
			entity.IdMarcaVehiculo = (System.Int16)reader[((int)PatCatalogoVehiculoColumn.IdMarcaVehiculo - 1)];
			entity.IdTipoServicio = (System.Byte)reader[((int)PatCatalogoVehiculoColumn.IdTipoServicio - 1)];
			entity.IdClaseVehiculo = (System.Byte)reader[((int)PatCatalogoVehiculoColumn.IdClaseVehiculo - 1)];
			entity.CapacidadPasajeros = (System.Byte)reader[((int)PatCatalogoVehiculoColumn.CapacidadPasajeros - 1)];
			entity.CapacidadCarga = (System.Int16)reader[((int)PatCatalogoVehiculoColumn.CapacidadCarga - 1)];
			entity.NumeroPuertas = (System.Byte)reader[((int)PatCatalogoVehiculoColumn.NumeroPuertas - 1)];
			entity.CodigoTransito = (System.String)reader[((int)PatCatalogoVehiculoColumn.CodigoTransito - 1)];
			entity.PorcentajeIva = (System.Decimal)reader[((int)PatCatalogoVehiculoColumn.PorcentajeIva - 1)];
			entity.IdGamaVehiculo = (System.Byte)reader[((int)PatCatalogoVehiculoColumn.IdGamaVehiculo - 1)];
			entity.IdGrupoCatalogo = (System.Int16)reader[((int)PatCatalogoVehiculoColumn.IdGrupoCatalogo - 1)];
			entity.VinBasico = (System.String)reader[((int)PatCatalogoVehiculoColumn.VinBasico - 1)];
			entity.Activo = (System.Boolean)reader[((int)PatCatalogoVehiculoColumn.Activo - 1)];
			entity.IdTipoCombustible = (System.Byte)reader[((int)PatCatalogoVehiculoColumn.IdTipoCombustible - 1)];
			entity.AcceptChanges();
		}
		
		/// <summary>
		/// Refreshes the <see cref="PAT.Entities.PatCatalogoVehiculo"/> object from the <see cref="DataSet"/>.
		/// </summary>
		/// <param name="dataSet">The <see cref="DataSet"/> to read from.</param>
		/// <param name="entity">The <see cref="PAT.Entities.PatCatalogoVehiculo"/> object.</param>
		public static void RefreshEntity(DataSet dataSet, PAT.Entities.PatCatalogoVehiculo entity)
		{
			DataRow dataRow = dataSet.Tables[0].Rows[0];
			
			entity.IdCatalogo = (System.Int32)dataRow["ID_CATALOGO"];
			entity.CodigoInternoCatalogo = (System.String)dataRow["CODIGO_INTERNO_CATALOGO"];
			entity.DescripcionCatalogo = (System.String)dataRow["DESCRIPCION_CATALOGO"];
			entity.Cilindraje = (System.String)dataRow["CILINDRAJE"];
			entity.IdMarcaVehiculo = (System.Int16)dataRow["ID_MARCA_VEHICULO"];
			entity.IdTipoServicio = (System.Byte)dataRow["ID_TIPO_SERVICIO"];
			entity.IdClaseVehiculo = (System.Byte)dataRow["ID_CLASE_VEHICULO"];
			entity.CapacidadPasajeros = (System.Byte)dataRow["CAPACIDAD_PASAJEROS"];
			entity.CapacidadCarga = (System.Int16)dataRow["CAPACIDAD_CARGA"];
			entity.NumeroPuertas = (System.Byte)dataRow["NUMERO_PUERTAS"];
			entity.CodigoTransito = (System.String)dataRow["CODIGO_TRANSITO"];
			entity.PorcentajeIva = (System.Decimal)dataRow["PORCENTAJE_IVA"];
			entity.IdGamaVehiculo = (System.Byte)dataRow["ID_GAMA_VEHICULO"];
			entity.IdGrupoCatalogo = (System.Int16)dataRow["ID_GRUPO_CATALOGO"];
			entity.VinBasico = (System.String)dataRow["VIN_BASICO"];
			entity.Activo = (System.Boolean)dataRow["ACTIVO"];
			entity.IdTipoCombustible = (System.Byte)dataRow["ID_TIPO_COMBUSTIBLE"];
			entity.AcceptChanges();
		}
		#endregion 
		
		#region DeepLoad Methods
		/// <summary>
		/// Deep Loads the <see cref="IEntity"/> object with criteria based of the child 
		/// property collections only N Levels Deep based on the <see cref="DeepLoadType"/>.
		/// </summary>
		/// <remarks>
		/// Use this method with caution as it is possible to DeepLoad with Recursion and traverse an entire object graph.
		/// </remarks>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="entity">The <see cref="PAT.Entities.PatCatalogoVehiculo"/> object to load.</param>
		/// <param name="deep">Boolean. A flag that indicates whether to recursively save all Property Collection that are descendants of this instance. If True, saves the complete object graph below this object. If False, saves this object only. </param>
		/// <param name="deepLoadType">DeepLoadType Enumeration to Include/Exclude object property collections from Load.</param>
		/// <param name="childTypes">PAT.Entities.PatCatalogoVehiculo Property Collection Type Array To Include or Exclude from Load</param>
		/// <param name="innerList">A collection of child types for easy access.</param>
	    /// <exception cref="ArgumentNullException">entity or childTypes is null.</exception>
	    /// <exception cref="ArgumentException">deepLoadType has invalid value.</exception>
		public override void DeepLoad(TransactionManager transactionManager, PAT.Entities.PatCatalogoVehiculo entity, bool deep, DeepLoadType deepLoadType, System.Type[] childTypes, DeepSession innerList)
		{
			if(entity == null)
				return;

			#region IdClaseVehiculoSource	
			if (CanDeepLoad(entity, "PatClaseVehiculo|IdClaseVehiculoSource", deepLoadType, innerList) 
				&& entity.IdClaseVehiculoSource == null)
			{
				object[] pkItems = new object[1];
				pkItems[0] = entity.IdClaseVehiculo;
				PatClaseVehiculo tmpEntity = EntityManager.LocateEntity<PatClaseVehiculo>(EntityLocator.ConstructKeyFromPkItems(typeof(PatClaseVehiculo), pkItems), DataRepository.Provider.EnableEntityTracking);
				if (tmpEntity != null)
					entity.IdClaseVehiculoSource = tmpEntity;
				else
					entity.IdClaseVehiculoSource = DataRepository.PatClaseVehiculoProvider.GetByIdClaseVehiculo(transactionManager, entity.IdClaseVehiculo);		
				
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'IdClaseVehiculoSource' loaded. key " + entity.EntityTrackingKey);
				#endif 
				
				if (deep && entity.IdClaseVehiculoSource != null)
				{
					innerList.SkipChildren = true;
					DataRepository.PatClaseVehiculoProvider.DeepLoad(transactionManager, entity.IdClaseVehiculoSource, deep, deepLoadType, childTypes, innerList);
					innerList.SkipChildren = false;
				}
					
			}
			#endregion IdClaseVehiculoSource

			#region IdGamaVehiculoSource	
			if (CanDeepLoad(entity, "PatGamaVehiculo|IdGamaVehiculoSource", deepLoadType, innerList) 
				&& entity.IdGamaVehiculoSource == null)
			{
				object[] pkItems = new object[1];
				pkItems[0] = entity.IdGamaVehiculo;
				PatGamaVehiculo tmpEntity = EntityManager.LocateEntity<PatGamaVehiculo>(EntityLocator.ConstructKeyFromPkItems(typeof(PatGamaVehiculo), pkItems), DataRepository.Provider.EnableEntityTracking);
				if (tmpEntity != null)
					entity.IdGamaVehiculoSource = tmpEntity;
				else
					entity.IdGamaVehiculoSource = DataRepository.PatGamaVehiculoProvider.GetByIdGamaVehiculo(transactionManager, entity.IdGamaVehiculo);		
				
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'IdGamaVehiculoSource' loaded. key " + entity.EntityTrackingKey);
				#endif 
				
				if (deep && entity.IdGamaVehiculoSource != null)
				{
					innerList.SkipChildren = true;
					DataRepository.PatGamaVehiculoProvider.DeepLoad(transactionManager, entity.IdGamaVehiculoSource, deep, deepLoadType, childTypes, innerList);
					innerList.SkipChildren = false;
				}
					
			}
			#endregion IdGamaVehiculoSource

			#region IdGrupoCatalogoSource	
			if (CanDeepLoad(entity, "PatGrupoCatalogo|IdGrupoCatalogoSource", deepLoadType, innerList) 
				&& entity.IdGrupoCatalogoSource == null)
			{
				object[] pkItems = new object[1];
				pkItems[0] = entity.IdGrupoCatalogo;
				PatGrupoCatalogo tmpEntity = EntityManager.LocateEntity<PatGrupoCatalogo>(EntityLocator.ConstructKeyFromPkItems(typeof(PatGrupoCatalogo), pkItems), DataRepository.Provider.EnableEntityTracking);
				if (tmpEntity != null)
					entity.IdGrupoCatalogoSource = tmpEntity;
				else
					entity.IdGrupoCatalogoSource = DataRepository.PatGrupoCatalogoProvider.GetByIdGrupoCatalogo(transactionManager, entity.IdGrupoCatalogo);		
				
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'IdGrupoCatalogoSource' loaded. key " + entity.EntityTrackingKey);
				#endif 
				
				if (deep && entity.IdGrupoCatalogoSource != null)
				{
					innerList.SkipChildren = true;
					DataRepository.PatGrupoCatalogoProvider.DeepLoad(transactionManager, entity.IdGrupoCatalogoSource, deep, deepLoadType, childTypes, innerList);
					innerList.SkipChildren = false;
				}
					
			}
			#endregion IdGrupoCatalogoSource

			#region IdMarcaVehiculoSource	
			if (CanDeepLoad(entity, "PatMarcaVehiculo|IdMarcaVehiculoSource", deepLoadType, innerList) 
				&& entity.IdMarcaVehiculoSource == null)
			{
				object[] pkItems = new object[1];
				pkItems[0] = entity.IdMarcaVehiculo;
				PatMarcaVehiculo tmpEntity = EntityManager.LocateEntity<PatMarcaVehiculo>(EntityLocator.ConstructKeyFromPkItems(typeof(PatMarcaVehiculo), pkItems), DataRepository.Provider.EnableEntityTracking);
				if (tmpEntity != null)
					entity.IdMarcaVehiculoSource = tmpEntity;
				else
					entity.IdMarcaVehiculoSource = DataRepository.PatMarcaVehiculoProvider.GetByIdMarcaVehiculo(transactionManager, entity.IdMarcaVehiculo);		
				
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'IdMarcaVehiculoSource' loaded. key " + entity.EntityTrackingKey);
				#endif 
				
				if (deep && entity.IdMarcaVehiculoSource != null)
				{
					innerList.SkipChildren = true;
					DataRepository.PatMarcaVehiculoProvider.DeepLoad(transactionManager, entity.IdMarcaVehiculoSource, deep, deepLoadType, childTypes, innerList);
					innerList.SkipChildren = false;
				}
					
			}
			#endregion IdMarcaVehiculoSource

			#region IdTipoCombustibleSource	
			if (CanDeepLoad(entity, "PatTipoCombustible|IdTipoCombustibleSource", deepLoadType, innerList) 
				&& entity.IdTipoCombustibleSource == null)
			{
				object[] pkItems = new object[1];
				pkItems[0] = entity.IdTipoCombustible;
				PatTipoCombustible tmpEntity = EntityManager.LocateEntity<PatTipoCombustible>(EntityLocator.ConstructKeyFromPkItems(typeof(PatTipoCombustible), pkItems), DataRepository.Provider.EnableEntityTracking);
				if (tmpEntity != null)
					entity.IdTipoCombustibleSource = tmpEntity;
				else
					entity.IdTipoCombustibleSource = DataRepository.PatTipoCombustibleProvider.GetByIdTipoCombustible(transactionManager, entity.IdTipoCombustible);		
				
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'IdTipoCombustibleSource' loaded. key " + entity.EntityTrackingKey);
				#endif 
				
				if (deep && entity.IdTipoCombustibleSource != null)
				{
					innerList.SkipChildren = true;
					DataRepository.PatTipoCombustibleProvider.DeepLoad(transactionManager, entity.IdTipoCombustibleSource, deep, deepLoadType, childTypes, innerList);
					innerList.SkipChildren = false;
				}
					
			}
			#endregion IdTipoCombustibleSource

			#region IdTipoServicioSource	
			if (CanDeepLoad(entity, "PatTipoServicio|IdTipoServicioSource", deepLoadType, innerList) 
				&& entity.IdTipoServicioSource == null)
			{
				object[] pkItems = new object[1];
				pkItems[0] = entity.IdTipoServicio;
				PatTipoServicio tmpEntity = EntityManager.LocateEntity<PatTipoServicio>(EntityLocator.ConstructKeyFromPkItems(typeof(PatTipoServicio), pkItems), DataRepository.Provider.EnableEntityTracking);
				if (tmpEntity != null)
					entity.IdTipoServicioSource = tmpEntity;
				else
					entity.IdTipoServicioSource = DataRepository.PatTipoServicioProvider.GetByIdTipoServicio(transactionManager, entity.IdTipoServicio);		
				
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'IdTipoServicioSource' loaded. key " + entity.EntityTrackingKey);
				#endif 
				
				if (deep && entity.IdTipoServicioSource != null)
				{
					innerList.SkipChildren = true;
					DataRepository.PatTipoServicioProvider.DeepLoad(transactionManager, entity.IdTipoServicioSource, deep, deepLoadType, childTypes, innerList);
					innerList.SkipChildren = false;
				}
					
			}
			#endregion IdTipoServicioSource
			
			//used to hold DeepLoad method delegates and fire after all the local children have been loaded.
			Dictionary<string, KeyValuePair<Delegate, object>> deepHandles = new Dictionary<string, KeyValuePair<Delegate, object>>();
			// Deep load child collections  - Call GetByIdCatalogo methods when available
			
			#region IdItemInventarioPatItemInventarioCollection_From_PatItemCatalogo
			// RelationshipType.ManyToMany
			if (CanDeepLoad(entity, "List<PatItemInventario>|IdItemInventarioPatItemInventarioCollection_From_PatItemCatalogo", deepLoadType, innerList))
			{
				entity.IdItemInventarioPatItemInventarioCollection_From_PatItemCatalogo = DataRepository.PatItemInventarioProvider.GetByIdCatalogoFromPatItemCatalogo(transactionManager, entity.IdCatalogo);			 
		
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'IdItemInventarioPatItemInventarioCollection_From_PatItemCatalogo' loaded. key " + entity.EntityTrackingKey);
				#endif 
				
				if (deep && entity.IdItemInventarioPatItemInventarioCollection_From_PatItemCatalogo != null)
				{
					deepHandles.Add("IdItemInventarioPatItemInventarioCollection_From_PatItemCatalogo",
						new KeyValuePair<Delegate, object>((DeepLoadHandle< PatItemInventario >) DataRepository.PatItemInventarioProvider.DeepLoad,
						new object[] { transactionManager, entity.IdItemInventarioPatItemInventarioCollection_From_PatItemCatalogo, deep, deepLoadType, childTypes, innerList }
					));
				}
			}
			#endregion
			
			
			
			#region PatCitaTallerCollection
			//Relationship Type One : Many
			if (CanDeepLoad(entity, "List<PatCitaTaller>|PatCitaTallerCollection", deepLoadType, innerList)) 
			{
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'PatCitaTallerCollection' loaded. key " + entity.EntityTrackingKey);
				#endif 

				entity.PatCitaTallerCollection = DataRepository.PatCitaTallerProvider.GetByIdCatalogo(transactionManager, entity.IdCatalogo);

				if (deep && entity.PatCitaTallerCollection.Count > 0)
				{
					deepHandles.Add("PatCitaTallerCollection",
						new KeyValuePair<Delegate, object>((DeepLoadHandle<PatCitaTaller>) DataRepository.PatCitaTallerProvider.DeepLoad,
						new object[] { transactionManager, entity.PatCitaTallerCollection, deep, deepLoadType, childTypes, innerList }
					));
				}
			}		
			#endregion 
			
			
			#region PatItemCatalogoCollection
			//Relationship Type One : Many
			if (CanDeepLoad(entity, "List<PatItemCatalogo>|PatItemCatalogoCollection", deepLoadType, innerList)) 
			{
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'PatItemCatalogoCollection' loaded. key " + entity.EntityTrackingKey);
				#endif 

				entity.PatItemCatalogoCollection = DataRepository.PatItemCatalogoProvider.GetByIdCatalogo(transactionManager, entity.IdCatalogo);

				if (deep && entity.PatItemCatalogoCollection.Count > 0)
				{
					deepHandles.Add("PatItemCatalogoCollection",
						new KeyValuePair<Delegate, object>((DeepLoadHandle<PatItemCatalogo>) DataRepository.PatItemCatalogoProvider.DeepLoad,
						new object[] { transactionManager, entity.PatItemCatalogoCollection, deep, deepLoadType, childTypes, innerList }
					));
				}
			}		
			#endregion 
			
			
			#region PatVehiculoCollection
			//Relationship Type One : Many
			if (CanDeepLoad(entity, "List<PatVehiculo>|PatVehiculoCollection", deepLoadType, innerList)) 
			{
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'PatVehiculoCollection' loaded. key " + entity.EntityTrackingKey);
				#endif 

				entity.PatVehiculoCollection = DataRepository.PatVehiculoProvider.GetByIdCatalogo(transactionManager, entity.IdCatalogo);

				if (deep && entity.PatVehiculoCollection.Count > 0)
				{
					deepHandles.Add("PatVehiculoCollection",
						new KeyValuePair<Delegate, object>((DeepLoadHandle<PatVehiculo>) DataRepository.PatVehiculoProvider.DeepLoad,
						new object[] { transactionManager, entity.PatVehiculoCollection, deep, deepLoadType, childTypes, innerList }
					));
				}
			}		
			#endregion 
			
			
			//Fire all DeepLoad Items
			foreach(KeyValuePair<Delegate, object> pair in deepHandles.Values)
		    {
                pair.Key.DynamicInvoke((object[])pair.Value);
		    }
			deepHandles = null;
		}
		
		#endregion 
		
		#region DeepSave Methods

		/// <summary>
		/// Deep Save the entire object graph of the PAT.Entities.PatCatalogoVehiculo object with criteria based of the child 
		/// Type property array and DeepSaveType.
		/// </summary>
		/// <param name="transactionManager">The transaction manager.</param>
		/// <param name="entity">PAT.Entities.PatCatalogoVehiculo instance</param>
		/// <param name="deepSaveType">DeepSaveType Enumeration to Include/Exclude object property collections from Save.</param>
		/// <param name="childTypes">PAT.Entities.PatCatalogoVehiculo Property Collection Type Array To Include or Exclude from Save</param>
		/// <param name="innerList">A Hashtable of child types for easy access.</param>
		public override bool DeepSave(TransactionManager transactionManager, PAT.Entities.PatCatalogoVehiculo entity, DeepSaveType deepSaveType, System.Type[] childTypes, DeepSession innerList)
		{	
			if (entity == null)
				return false;
							
			#region Composite Parent Properties
			//Save Source Composite Properties, however, don't call deep save on them.  
			//So they only get saved a single level deep.
			
			#region IdClaseVehiculoSource
			if (CanDeepSave(entity, "PatClaseVehiculo|IdClaseVehiculoSource", deepSaveType, innerList) 
				&& entity.IdClaseVehiculoSource != null)
			{
				DataRepository.PatClaseVehiculoProvider.Save(transactionManager, entity.IdClaseVehiculoSource);
				entity.IdClaseVehiculo = entity.IdClaseVehiculoSource.IdClaseVehiculo;
			}
			#endregion 
			
			#region IdGamaVehiculoSource
			if (CanDeepSave(entity, "PatGamaVehiculo|IdGamaVehiculoSource", deepSaveType, innerList) 
				&& entity.IdGamaVehiculoSource != null)
			{
				DataRepository.PatGamaVehiculoProvider.Save(transactionManager, entity.IdGamaVehiculoSource);
				entity.IdGamaVehiculo = entity.IdGamaVehiculoSource.IdGamaVehiculo;
			}
			#endregion 
			
			#region IdGrupoCatalogoSource
			if (CanDeepSave(entity, "PatGrupoCatalogo|IdGrupoCatalogoSource", deepSaveType, innerList) 
				&& entity.IdGrupoCatalogoSource != null)
			{
				DataRepository.PatGrupoCatalogoProvider.Save(transactionManager, entity.IdGrupoCatalogoSource);
				entity.IdGrupoCatalogo = entity.IdGrupoCatalogoSource.IdGrupoCatalogo;
			}
			#endregion 
			
			#region IdMarcaVehiculoSource
			if (CanDeepSave(entity, "PatMarcaVehiculo|IdMarcaVehiculoSource", deepSaveType, innerList) 
				&& entity.IdMarcaVehiculoSource != null)
			{
				DataRepository.PatMarcaVehiculoProvider.Save(transactionManager, entity.IdMarcaVehiculoSource);
				entity.IdMarcaVehiculo = entity.IdMarcaVehiculoSource.IdMarcaVehiculo;
			}
			#endregion 
			
			#region IdTipoCombustibleSource
			if (CanDeepSave(entity, "PatTipoCombustible|IdTipoCombustibleSource", deepSaveType, innerList) 
				&& entity.IdTipoCombustibleSource != null)
			{
				DataRepository.PatTipoCombustibleProvider.Save(transactionManager, entity.IdTipoCombustibleSource);
				entity.IdTipoCombustible = entity.IdTipoCombustibleSource.IdTipoCombustible;
			}
			#endregion 
			
			#region IdTipoServicioSource
			if (CanDeepSave(entity, "PatTipoServicio|IdTipoServicioSource", deepSaveType, innerList) 
				&& entity.IdTipoServicioSource != null)
			{
				DataRepository.PatTipoServicioProvider.Save(transactionManager, entity.IdTipoServicioSource);
				entity.IdTipoServicio = entity.IdTipoServicioSource.IdTipoServicio;
			}
			#endregion 
			#endregion Composite Parent Properties

			// Save Root Entity through Provider
			if (!entity.IsDeleted)
				this.Save(transactionManager, entity);
			
			//used to hold DeepSave method delegates and fire after all the local children have been saved.
			Dictionary<string, KeyValuePair<Delegate, object>> deepHandles = new Dictionary<string, KeyValuePair<Delegate, object>>();

			#region IdItemInventarioPatItemInventarioCollection_From_PatItemCatalogo>
			if (CanDeepSave(entity.IdItemInventarioPatItemInventarioCollection_From_PatItemCatalogo, "List<PatItemInventario>|IdItemInventarioPatItemInventarioCollection_From_PatItemCatalogo", deepSaveType, innerList))
			{
				if (entity.IdItemInventarioPatItemInventarioCollection_From_PatItemCatalogo.Count > 0 || entity.IdItemInventarioPatItemInventarioCollection_From_PatItemCatalogo.DeletedItems.Count > 0)
				{
					DataRepository.PatItemInventarioProvider.Save(transactionManager, entity.IdItemInventarioPatItemInventarioCollection_From_PatItemCatalogo); 
					deepHandles.Add("IdItemInventarioPatItemInventarioCollection_From_PatItemCatalogo",
						new KeyValuePair<Delegate, object>((DeepSaveHandle<PatItemInventario>) DataRepository.PatItemInventarioProvider.DeepSave,
						new object[] { transactionManager, entity.IdItemInventarioPatItemInventarioCollection_From_PatItemCatalogo, deepSaveType, childTypes, innerList }
					));
				}
			}
			#endregion 
	
			#region List<PatCitaTaller>
				if (CanDeepSave(entity.PatCitaTallerCollection, "List<PatCitaTaller>|PatCitaTallerCollection", deepSaveType, innerList)) 
				{	
					// update each child parent id with the real parent id (mostly used on insert)
					foreach(PatCitaTaller child in entity.PatCitaTallerCollection)
					{
						if(child.IdCatalogoSource != null)
						{
							child.IdCatalogo = child.IdCatalogoSource.IdCatalogo;
						}
						else
						{
							child.IdCatalogo = entity.IdCatalogo;
						}

					}

					if (entity.PatCitaTallerCollection.Count > 0 || entity.PatCitaTallerCollection.DeletedItems.Count > 0)
					{
						//DataRepository.PatCitaTallerProvider.Save(transactionManager, entity.PatCitaTallerCollection);
						
						deepHandles.Add("PatCitaTallerCollection",
						new KeyValuePair<Delegate, object>((DeepSaveHandle< PatCitaTaller >) DataRepository.PatCitaTallerProvider.DeepSave,
							new object[] { transactionManager, entity.PatCitaTallerCollection, deepSaveType, childTypes, innerList }
						));
					}
				} 
			#endregion 
				
	
			#region List<PatItemCatalogo>
				if (CanDeepSave(entity.PatItemCatalogoCollection, "List<PatItemCatalogo>|PatItemCatalogoCollection", deepSaveType, innerList)) 
				{	
					// update each child parent id with the real parent id (mostly used on insert)
					foreach(PatItemCatalogo child in entity.PatItemCatalogoCollection)
					{
						if(child.IdCatalogoSource != null)
						{
								child.IdCatalogo = child.IdCatalogoSource.IdCatalogo;
						}

						if(child.IdItemInventarioSource != null)
						{
								child.IdItemInventario = child.IdItemInventarioSource.IdItemInventario;
						}

					}

					if (entity.PatItemCatalogoCollection.Count > 0 || entity.PatItemCatalogoCollection.DeletedItems.Count > 0)
					{
						//DataRepository.PatItemCatalogoProvider.Save(transactionManager, entity.PatItemCatalogoCollection);
						
						deepHandles.Add("PatItemCatalogoCollection",
						new KeyValuePair<Delegate, object>((DeepSaveHandle< PatItemCatalogo >) DataRepository.PatItemCatalogoProvider.DeepSave,
							new object[] { transactionManager, entity.PatItemCatalogoCollection, deepSaveType, childTypes, innerList }
						));
					}
				} 
			#endregion 
				
	
			#region List<PatVehiculo>
				if (CanDeepSave(entity.PatVehiculoCollection, "List<PatVehiculo>|PatVehiculoCollection", deepSaveType, innerList)) 
				{	
					// update each child parent id with the real parent id (mostly used on insert)
					foreach(PatVehiculo child in entity.PatVehiculoCollection)
					{
						if(child.IdCatalogoSource != null)
						{
							child.IdCatalogo = child.IdCatalogoSource.IdCatalogo;
						}
						else
						{
							child.IdCatalogo = entity.IdCatalogo;
						}

					}

					if (entity.PatVehiculoCollection.Count > 0 || entity.PatVehiculoCollection.DeletedItems.Count > 0)
					{
						//DataRepository.PatVehiculoProvider.Save(transactionManager, entity.PatVehiculoCollection);
						
						deepHandles.Add("PatVehiculoCollection",
						new KeyValuePair<Delegate, object>((DeepSaveHandle< PatVehiculo >) DataRepository.PatVehiculoProvider.DeepSave,
							new object[] { transactionManager, entity.PatVehiculoCollection, deepSaveType, childTypes, innerList }
						));
					}
				} 
			#endregion 
				
			//Fire all DeepSave Items
			foreach(KeyValuePair<Delegate, object> pair in deepHandles.Values)
		    {
                pair.Key.DynamicInvoke((object[])pair.Value);
		    }
			
			// Save Root Entity through Provider, if not already saved in delete mode
			if (entity.IsDeleted)
				this.Save(transactionManager, entity);
				

			deepHandles = null;
						
			return true;
		}
		#endregion
	} // end class
	
	#region PatCatalogoVehiculoChildEntityTypes
	
	///<summary>
	/// Enumeration used to expose the different child entity types 
	/// for child properties in <c>PAT.Entities.PatCatalogoVehiculo</c>
	///</summary>
	public enum PatCatalogoVehiculoChildEntityTypes
	{
		
		///<summary>
		/// Composite Property for <c>PatClaseVehiculo</c> at IdClaseVehiculoSource
		///</summary>
		[ChildEntityType(typeof(PatClaseVehiculo))]
		PatClaseVehiculo,
			
		///<summary>
		/// Composite Property for <c>PatGamaVehiculo</c> at IdGamaVehiculoSource
		///</summary>
		[ChildEntityType(typeof(PatGamaVehiculo))]
		PatGamaVehiculo,
			
		///<summary>
		/// Composite Property for <c>PatGrupoCatalogo</c> at IdGrupoCatalogoSource
		///</summary>
		[ChildEntityType(typeof(PatGrupoCatalogo))]
		PatGrupoCatalogo,
			
		///<summary>
		/// Composite Property for <c>PatMarcaVehiculo</c> at IdMarcaVehiculoSource
		///</summary>
		[ChildEntityType(typeof(PatMarcaVehiculo))]
		PatMarcaVehiculo,
			
		///<summary>
		/// Composite Property for <c>PatTipoCombustible</c> at IdTipoCombustibleSource
		///</summary>
		[ChildEntityType(typeof(PatTipoCombustible))]
		PatTipoCombustible,
			
		///<summary>
		/// Composite Property for <c>PatTipoServicio</c> at IdTipoServicioSource
		///</summary>
		[ChildEntityType(typeof(PatTipoServicio))]
		PatTipoServicio,
	
		///<summary>
		/// Collection of <c>PatCatalogoVehiculo</c> as ManyToMany for PatItemInventarioCollection_From_PatItemCatalogo
		///</summary>
		[ChildEntityType(typeof(TList<PatItemInventario>))]
		IdItemInventarioPatItemInventarioCollection_From_PatItemCatalogo,

		///<summary>
		/// Collection of <c>PatCatalogoVehiculo</c> as OneToMany for PatCitaTallerCollection
		///</summary>
		[ChildEntityType(typeof(TList<PatCitaTaller>))]
		PatCitaTallerCollection,

		///<summary>
		/// Collection of <c>PatCatalogoVehiculo</c> as OneToMany for PatItemCatalogoCollection
		///</summary>
		[ChildEntityType(typeof(TList<PatItemCatalogo>))]
		PatItemCatalogoCollection,

		///<summary>
		/// Collection of <c>PatCatalogoVehiculo</c> as OneToMany for PatVehiculoCollection
		///</summary>
		[ChildEntityType(typeof(TList<PatVehiculo>))]
		PatVehiculoCollection,
	}
	
	#endregion PatCatalogoVehiculoChildEntityTypes
	
	#region PatCatalogoVehiculoFilterBuilder
	
	/// <summary>
	/// A strongly-typed instance of the <see cref="SqlFilterBuilder&lt;PatCatalogoVehiculoColumn&gt;"/> class
	/// that is used exclusively with a <see cref="PatCatalogoVehiculo"/> object.
	/// </summary>
	[CLSCompliant(true)]
	public class PatCatalogoVehiculoFilterBuilder : SqlFilterBuilder<PatCatalogoVehiculoColumn>
	{
		#region Constructors

		/// <summary>
		/// Initializes a new instance of the PatCatalogoVehiculoFilterBuilder class.
		/// </summary>
		public PatCatalogoVehiculoFilterBuilder() : base() { }

		/// <summary>
		/// Initializes a new instance of the PatCatalogoVehiculoFilterBuilder class.
		/// </summary>
		/// <param name="ignoreCase">Specifies whether to create case-insensitive statements.</param>
		public PatCatalogoVehiculoFilterBuilder(bool ignoreCase) : base(ignoreCase) { }

		/// <summary>
		/// Initializes a new instance of the PatCatalogoVehiculoFilterBuilder class.
		/// </summary>
		/// <param name="ignoreCase">Specifies whether to create case-insensitive statements.</param>
		/// <param name="useAnd">Specifies whether to combine statements using AND or OR.</param>
		public PatCatalogoVehiculoFilterBuilder(bool ignoreCase, bool useAnd) : base(ignoreCase, useAnd) { }

		#endregion Constructors
	}

	#endregion PatCatalogoVehiculoFilterBuilder
	
	#region PatCatalogoVehiculoParameterBuilder
	
	/// <summary>
	/// A strongly-typed instance of the <see cref="ParameterizedSqlFilterBuilder&lt;PatCatalogoVehiculoColumn&gt;"/> class
	/// that is used exclusively with a <see cref="PatCatalogoVehiculo"/> object.
	/// </summary>
	[CLSCompliant(true)]
	public class PatCatalogoVehiculoParameterBuilder : ParameterizedSqlFilterBuilder<PatCatalogoVehiculoColumn>
	{
		#region Constructors

		/// <summary>
		/// Initializes a new instance of the PatCatalogoVehiculoParameterBuilder class.
		/// </summary>
		public PatCatalogoVehiculoParameterBuilder() : base() { }

		/// <summary>
		/// Initializes a new instance of the PatCatalogoVehiculoParameterBuilder class.
		/// </summary>
		/// <param name="ignoreCase">Specifies whether to create case-insensitive statements.</param>
		public PatCatalogoVehiculoParameterBuilder(bool ignoreCase) : base(ignoreCase) { }

		/// <summary>
		/// Initializes a new instance of the PatCatalogoVehiculoParameterBuilder class.
		/// </summary>
		/// <param name="ignoreCase">Specifies whether to create case-insensitive statements.</param>
		/// <param name="useAnd">Specifies whether to combine statements using AND or OR.</param>
		public PatCatalogoVehiculoParameterBuilder(bool ignoreCase, bool useAnd) : base(ignoreCase, useAnd) { }

		#endregion Constructors
	}

	#endregion PatCatalogoVehiculoParameterBuilder
	
	#region PatCatalogoVehiculoSortBuilder
    
    /// <summary>
    /// A strongly-typed instance of the <see cref="SqlSortBuilder&lt;PatCatalogoVehiculoColumn&gt;"/> class
	/// that is used exclusively with a <see cref="PatCatalogoVehiculo"/> object.
    /// </summary>
    [CLSCompliant(true)]
    public class PatCatalogoVehiculoSortBuilder : SqlSortBuilder<PatCatalogoVehiculoColumn>
    {
		#region Constructors

		/// <summary>
		/// Initializes a new instance of the PatCatalogoVehiculoSqlSortBuilder class.
		/// </summary>
		public PatCatalogoVehiculoSortBuilder() : base() { }

		#endregion Constructors

    }    
    #endregion PatCatalogoVehiculoSortBuilder
	
} // end namespace
